﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Jogar.aspx.cs" Inherits="PerfilEmpreendedor.FrontEnd.Jogar" %>

<%@ Register Src="UserControls/Jogador.ascx" TagName="JogadorControl" TagPrefix="uc" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="Css/Estilos.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server">
    </ext:ResourceManager>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <ext:Hidden ID="hiddenPartida" runat="server" />
    <ext:Hidden ID="hiddenProximaPosicao" runat="server" />
    <ext:Hidden ID="hiddenProximoJogador" runat="server" />
    <ext:Viewport ID="Viewport1" runat="server">
        <Items>
            <ext:ColumnLayout ID="ColumnLayout1" runat="server" FitHeight="true">
                <Columns>
                    <ext:LayoutColumn ColumnWidth="0.2">
                        <ext:Panel ID="Panel1" runat="server" Title="Perfil Empreendedor">
                            <Content>
                                <uc:JogadorControl ID="ucJogador" runat="server"></uc:JogadorControl>
                            </Content>
                        </ext:Panel>
                    </ext:LayoutColumn>
                    <ext:LayoutColumn ColumnWidth="0.8">
                        <ext:Panel ID="Panel2" runat="server">
                            <Items>
                                <ext:GridPanel ID="gridDados" Title="Classificação" runat="server" Height="180">
                                    <Store>
                                        <ext:Store ID="storePontuacao">
                                            <Reader>
                                                <ext:ArrayReader IDProperty="Id">
                                                    <Fields>
                                                        <ext:RecordField Name="Id" />
                                                        <ext:RecordField Name="Jogador" />
                                                        <ext:RecordField Name="Pontos" />
                                                    </Fields>
                                                </ext:ArrayReader>
                                            </Reader>
                                        </ext:Store>
                                    </Store>
                                    <ColumnModel>
                                        <Columns>
                                        <ext:RowNumbererColumn></ext:RowNumbererColumn>
                                            <ext:Column Header="Jogador" Width="300" DataIndex="Jogador" />
                                            <ext:Column Header="Pontos" Width="100" DataIndex="Pontos" />
                                        </Columns>
                                    </ColumnModel>
                                    <DirectEvents>
                                        <Command>
                                            <EventMask Msg="Aguarde..." ShowMask="true" />
                                            <ExtraParams>
                                                <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                                                <ext:Parameter Name="command" Value="command" Mode="Raw" />
                                            </ExtraParams>
                                        </Command>
                                    </DirectEvents>
                                </ext:GridPanel>
                                <ext:GridPanel ID="griAcoes" Title="Histórico de Ações" runat="server" Height="510">
                                    <Store>
                                        <ext:Store ID="storeAcoes">
                                            <Reader>
                                                <ext:ArrayReader IDProperty="Id">
                                                    <Fields>
                                                        <ext:RecordField Name="Id" />
                                                        <ext:RecordField Name="Descricao" />
                                                        <ext:RecordField Name="Data" />
                                                    </Fields>
                                                </ext:ArrayReader>
                                            </Reader>
                                        </ext:Store>
                                    </Store>
                                    <ColumnModel>
                                        <Columns>
                                            <ext:Column Width="400" DataIndex="Descricao" />
                                            <ext:Column Width="200" DataIndex="Data" />
                                        </Columns>
                                    </ColumnModel>
                                    <BottomBar>
                                        <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="20" DisplayInfo="true"
                                            DisplayMsg="Exibindo registros {0} - {1} of {2}" EmptyMsg="Nenhuma ação registrada" />
                                    </BottomBar>
                                </ext:GridPanel>
                            </Items>
                        </ext:Panel>
                    </ext:LayoutColumn>
                </Columns>
            </ext:ColumnLayout>
        </Items>
    </ext:Viewport>
    <ext:Window ID="formResponderCartela" runat="server" Collapsible="true" Height="400"
        Icon="Application" Modal="true" Collapsed="false" Title="Uma nova cartela foi lançada pra você"
        Width="600" Hidden="true">
        <Items>
            <ext:FormPanel ID="FormPanel1" runat="server" ButtonAlign="Right" Height="400" Padding="5">
                <Items>
                    <ext:Hidden ID="hiddenIdHistorico" runat="server">
                    </ext:Hidden>
                    <ext:TextField ID="txtTipo" runat="server" AnchorHorizontal="100%" FieldLabel="Tema"
                        Disabled="true">
                    </ext:TextField>
                    <ext:TextField ID="txtResposta" runat="server" AnchorHorizontal="100%" FieldLabel="Resposta">
                    </ext:TextField>
                    <ext:GridPanel ID="gridDicas" runat="server" AnchorHorizontal="100%" Height="250">
                        <TopBar>
                            <ext:Toolbar ID="Toolbar1" runat="server">
                                <Items>
                                    <ext:Button ID="btnVisualizarDica" runat="server" Icon="Eye" Text="Visualizar dica">
                                        <DirectEvents>
                                            <Click OnEvent="VisualizarDica">
                                                <EventMask ShowMask="true" Msg="Aguarde..." />
                                            </Click>
                                        </DirectEvents>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <Store>
                            <ext:Store ID="storeDicas" runat="server">
                                <Reader>
                                    <ext:JsonReader IDProperty="Id">
                                        <Fields>
                                            <ext:RecordField Name="Id" />
                                            <ext:RecordField Name="Descricao" />
                                        </Fields>
                                    </ext:JsonReader>
                                </Reader>
                            </ext:Store>
                        </Store>
                        <ColumnModel>
                            <Columns>
                                <ext:RowNumbererColumn />
                                <ext:Column Width="400" DataIndex="Descricao" />
                            </Columns>
                        </ColumnModel>
                    </ext:GridPanel>
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons>
            <ext:Button ID="btnResponder" runat="server" Icon="Accept" Text="Confirmar resposta">
                <DirectEvents>
                    <Click OnEvent="Responder">
                        <EventMask ShowMask="true" Msg="Aguarde..." />
                    </Click>
                </DirectEvents>
            </ext:Button>
        </Buttons>
    </ext:Window>
    <ext:Window ID="formEscolherCartela" runat="server" Collapsible="true" Height="400"
        Icon="Application" Modal="true" Collapsed="false" Title="Você deve escolher uma nova cartela"
        Width="600" Hidden="true">
        <Items>
            <ext:FormPanel ID="FormPanel2" runat="server" ButtonAlign="Right" Height="400" Padding="5">
                <Items>
                    <ext:TextField ID="txtJogador" runat="server" AnchorHorizontal="100%" FieldLabel="Para"
                        Disabled="true">
                    </ext:TextField>
                    <ext:SelectBox ID="selectTipo" FieldLabel="Tema" runat="server" LabelWidth="120"
                        AnchorHorizontal="100%" EmptyText="Selecione um tema para listar cartelas" DisplayField="Descricao"
                        ValueField="Id" AllowBlank="false">
                        <Store>
                            <ext:Store>
                                <Reader>
                                    <ext:JsonReader>
                                        <Fields>
                                            <ext:RecordField Name="Id" />
                                            <ext:RecordField Name="Descricao" />
                                        </Fields>
                                    </ext:JsonReader>
                                </Reader>
                            </ext:Store>
                        </Store>
                        <DirectEvents>
                            <Select OnEvent="ListarCartelas">
                                <EventMask ShowMask="true" Msg="Aguarde, carregando cartelas disponíveis..." />
                            </Select>
                        </DirectEvents>
                    </ext:SelectBox>
                    <ext:GridPanel ID="gridCartao" runat="server" AnchorHorizontal="100%" Height="300">
                        <Store>
                            <ext:Store ID="storeCartelas" runat="server">
                                <Reader>
                                    <ext:JsonReader IDProperty="Id">
                                        <Fields>
                                            <ext:RecordField Name="Id" />
                                            <ext:RecordField Name="Resposta" />
                                            <ext:RecordField Name="DicasEmTexto" />
                                        </Fields>
                                    </ext:JsonReader>
                                </Reader>
                            </ext:Store>
                        </Store>
                        <ColumnModel>
                            <Columns>
                                <ext:CommandColumn Width="20" ButtonAlign="Center">
                                    <Commands>
                                        <ext:GridCommand Icon="Accept" CommandName="Selecionar">
                                            <ToolTip Text="Escolher esta" />
                                        </ext:GridCommand>
                                    </Commands>
                                </ext:CommandColumn>
                                <ext:Column Width="500" DataIndex="Resposta" />
                            </Columns>
                        </ColumnModel>
                        <BottomBar>
                            <ext:StatusBar ID="statusCartelas">
                                <Items>
                                    <ext:Label ID="Label1" runat="server" IsFormField="false" AnchorHorizontal="100%"
                                        Icon="Information" LabelAlign="Top" Text="Você pode visualizar dicas clicando em [+]" />
                                </Items>
                            </ext:StatusBar>
                        </BottomBar>
                        <DirectEvents>
                            <Command OnEvent="OnGridCommand">
                                <ExtraParams>
                                    <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                                    <ext:Parameter Name="command" Value="command" Mode="Raw" />
                                </ExtraParams>
                            </Command>
                        </DirectEvents>
                        <Plugins>
                            <ext:RowExpander ID="RowExpander1" runat="server">
                                <Template ID="Template1" runat="server">
                                    <Html>
                                        <tpl for=".">
                                        <p><b>Dicas:</b> {DicasEmTexto}</p>
                                        </tpl>
                                    </Html>
                                </Template>
                            </ext:RowExpander>
                        </Plugins>
                    </ext:GridPanel>
                </Items>
            </ext:FormPanel>
        </Items>
    </ext:Window>
    <ext:TaskManager ID="timer" runat="server">
        <Tasks>
            <ext:Task TaskID="taskGeral" Interval="3000" AutoRun="true">
            <DirectEvents>
            <Update OnEvent="OnTaskUpdate">
            </Update>
            </DirectEvents>
            </ext:Task>
        </Tasks>
    </ext:TaskManager>
    </form>
</body>
</html>
